package edu.mercer.medapps.documentbldr;

import java.util.HashMap;
import java.util.Map;

import com.google.common.collect.ImmutableMap;

/**
 * Data class for storing objects, information using String keys.<p>
 * 
 * Concise, flexible representation of Map.<p>
 * 
 * <ul>
 * <li>Key: String
 * <li>Value: Generic B extends Object
 * </ul>
 */

public class Info<B extends Object> 
{
	private Map<String,B> _info = mapInit(); 
	
	
	Info()
	{
		super();
		
		_info = mapInit();
		
	}//constructor


	private HashMap<String,B> mapInit()
	{
		return new HashMap<String,B>();
		
	}//method
	
	
	/**
	 * @return ImmutableMap &#60; String,B &#62; - read only Map String key and 
	 * Generic value
	 */
	
	ImmutableMap<String,B> list()
	{
		return ImmutableMap.copyOf(_info);
		
	}//method

	
	/**
	 * Replace into Map using String key, Generic value.<p>
	 * 
	 * @param keyIn - String, not null. New or existing key.
	 * 
	 * @param valueIn - Generic matching type of other values: Generic B.
	 * 
	 * @return Info &#60; B &#62; - this instance
	 */
	
	Info<B> update(final String keyIn, final B valueIn)
	{
		_info.put(keyIn, valueIn);
		
		return this;
		
	}//method
	
	
}//class
